<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateProductsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('products', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('brand_id')->nullable()->index('brand_id');
			$table->string('image')->nullable();
			$table->string('name')->nullable()->default('');
			$table->decimal('price', 10)->nullable();
			$table->integer('stock')->default(-1);
			$table->smallInteger('sort_order')->default(100);
			$table->text('content', 65535)->nullable();
			$table->timestamps();
			$table->softDeletes();
			$table->integer('is_top')->nullable();
			$table->integer('is_selling')->nullable();
			$table->integer('is_recommend')->nullable();
			$table->integer('is_new')->nullable();
			$table->integer('is_shelves')->nullable();
			$table->text('description', 65535)->nullable();
			$table->text('markdown_html_code', 65535)->nullable();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('products');
	}

}
